Black Friday Sale Upgrade Your Home →

Set up Netlify deployments for a Next.js blog

  • Even though our site is not finished, publishing it to netlify will let us test the entire development workflow
  • To deploy to netlify create a netlify.toml file:
BASH
[build]
command = "npm run build && npm run export"
publish = "out"
  • This file will tell Netlify how to build our site
  • Push all your changes to your repo and log in to your Netlify account. Select your nextjs blog repo and then deploy the site.
  • If all went well, you site should be deployed to Netlify! Congrats 🥳

Add client-side transitions to a Next.js app

  • In order to link from one page to another in our Next.js site we're going to import the Link component from next/link
  • 📜 Next.js Documentation for Link
  • For static pages we just provide the Link component with a href property linking to the page
  • For dynamic pages we must set the href property to our dynamic page (in our case posts/[id]) and also set the as property as it will be shown in the browser: as={`posts/${posts.id}`}

  Previous      Next